package engine.tip.tipItem
{
	import engine.data.ModelLocator;
	import engine.data.ObjectData;
	import engine.data.RoleVo;
	import engine.newUi.SkillLogic;
	
	import newx.com.config.StaticIni;
	
	public class SkillItemTips extends BaseTipItem
	{
		private var _model:ModelLocator;
		public function SkillItemTips(data:ObjectData=null)
		{
			super(data);
			init()
		}
		
		protected function init():void 
		{
			_model		=	ModelLocator.getInstance();
		}
		
		override public function getMainStr():String
		{
//			return StaticIni.getSwfLangStr("SkillDes_" + _data["Properties"]["configid"]);
			var skillexp:int = _model.scene.Role.GetProperties("SkillExp");
			var goldCoin:int = _model.scene.Role.GetProperties("GoldCoin");
			var proe:Array = StaticIni.getIniVar("addProp_"+_data["ConfigID"],"r").split(",");
			var des:String = "";
			
			if(getSkill(configId))
			{
				des = 	StaticIni.getSwfLangStr("SkillDes_"+configId);
				if(SkillLogic.getInstance().getAllSkill(configId))
				{
					return StaticIni.getSwfLangStrVar("UIString_1000456",
						[StaticIni.getSwfLangStr(configId),
							des]);
				}
				else
				{
					return StaticIni.getSwfLangStrVar("UIString_1000255",
						[StaticIni.getSwfLangStr(configId),
							des,
							
							skillexp < int(_data["NeedExp"])?StaticIni.getSwfLangStrVar("UIStr_1001746",
								[_data["NeedExp"]]):_data["NeedExp"],
							//				goldCoin < int(_data["NeedGold"])?StaticIni.getSwfLangStrVar("UIStr_1001746",[_data["NeedGold"]]):_data["NeedGold"],
						]);
				}
				
			}else
			{
				des = StaticIni.getSwfLangStrVar("Item_"+proe[0],[proe[1]]);
				if(SkillLogic.getInstance().getAllSkill(configId))
				{
					return des;
 //						StaticIni.getSwfLangStrVar("UIString_1000456",
//						[StaticIni.getSwfLangStr(configId),
//							des]);
				}
				else
				{
					return StaticIni.getSwfLangStrVar("UIString_1000031",
						//				[StaticIni.getSwfLangStr(configId),
						
						[des,
							
							skillexp < int(_data["NeedExp"])?StaticIni.getSwfLangStrVar("UIStr_1001746",[_data["NeedExp"]]):_data["NeedExp"],
							//				goldCoin < int(_data["NeedGold"])?StaticIni.getSwfLangStrVar("UIStr_1001746",[_data["NeedGold"]]):_data["NeedGold"],
						]);
				}
				
			}
			return "";
		}
		
		private function getSkill(configid:String):Boolean
		{
			var Prof:int = _model.scene.Role.getPlayerProf();
			var _skilltopArr:Array = StaticIni.getIniVar("allskill_"+Prof,"skill").split(",");
			for(var i:int = 0;i<_skilltopArr.length;i++)
			{
				if(_skilltopArr[i] == configid)
				{
					return true;
				}
			}
			return false;
		}
	}
}